package com.adnaan.backend.mapper;

import com.adnaan.backend.entity.Article;
import com.adnaan.backend.entity.dto.OptionDto;
import com.adnaan.backend.entity.vo.ViewHistoryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {
    List<OptionDto> getTags(@Param("articleId") Long id);

    void deleteTags(@Param("articleId") Long id);

    void insertTags(@Param("articleId") Long id, @Param("tagIds") List<String> tagIds);

    boolean containsRecord(@Param("articleId") Long articleId, @Param("userId") Long userId);

    boolean updateHistory(@Param("viewHistoryVo") ViewHistoryVo viewHistoryVo);

    boolean insertHistory(@Param("viewHistoryVo") ViewHistoryVo viewHistoryVo);

    Integer getLikeCount(@Param("articleId") Long id);

    Map<String, String> getContent(@Param("articleId") Long articleId);

    Long viewCount(@Param("userId") Long userId);

    Long recognitionCount(@Param("userId") Long userId);

    boolean clearViewHistory(@Param("userId") Long userId);

    void increasePageView(@Param("articleId") Long id);

    List<Long> getArticleIdsByTagIds(@Param("list") List<Integer> list);

    Integer getProcess(@Param("userId") Long userId, @Param("articleId") Long id);
}
